package com.huawei.hwid;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import com.huawei.hwid.UseCase.a;
import com.huawei.hwid.core.d.b.e;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public final class d implements c {
    private static final BlockingQueue<Runnable> a = new LinkedBlockingQueue();
    private static final int b = Runtime.getRuntime().availableProcessors();
    private static final int c = Math.max(2, Math.min(b - 1, 4));
    private static final int d = ((b * 2) + 1);
    private static d e;
    private final Handler f = new Handler(Looper.getMainLooper());
    private String g = "for findbugs should be delete";
    private ThreadPoolExecutor h = new ThreadPoolExecutor(c, d, 30, TimeUnit.SECONDS, a);

    private d() {
    }

    public static d a() {
        d dVar;
        synchronized (d.class) {
            if (e == null) {
                e = new d();
            }
            dVar = e;
        }
        return dVar;
    }

    public void a(Runnable runnable) {
        this.h.execute(runnable);
    }

    public void a(final Bundle bundle, final a aVar) {
        this.f.post(new Runnable(this) {
            final /* synthetic */ d c;

            public void run() {
                e.a("UseCaseThreadPoolScheduler", "notifyResponse " + this.c.g, true);
                if (aVar != null) {
                    aVar.a(bundle);
                }
            }
        });
    }

    public void b(Bundle bundle, a aVar) {
        this.f.post(new 2(this, aVar, bundle));
    }
}
